package entities;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;

public class DataBase implements Serializable {
	
	
	private ArrayList<IOrder> orderList = new ArrayList<IOrder>();
	private ArrayList<IMaster> masterList = new ArrayList<IMaster>();
	private ArrayList<IGarage> garageList = new ArrayList<IGarage>();
	private  HashMap<String,Integer> idBase=new HashMap<String,Integer>();
	private static DataBase DATA_BASE;
	
	private DataBase(){
		
	}
	
	
	public static DataBase getInstance(){
		if(DATA_BASE==null){
			
			DATA_BASE=new DataBase();
		}
		return DATA_BASE;
	}
	

	 HashMap<String,Integer> getIdBase(){
		return idBase;
	}	 
	 
	public ArrayList<IMaster> getMasterList() {
		return masterList;
	}

	public ArrayList<IGarage> getGarageList() {
		return garageList;
	}

	public ArrayList<IOrder> getOrderList() {
		return orderList;
	}

	
	public void saveGarageListToBD(ArrayList<IGarage> gar){
		garageList.clear();
		garageList.addAll(gar);
	}
	
	public void saveOrderListToBD(ArrayList<IOrder> ord){
		orderList.clear();
		orderList.addAll(ord);
	}
	
	public void saveMasterListToBD(ArrayList<IMaster> mas){
		masterList.clear();
		masterList.addAll(mas);
	}
	
	
}
